UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y4DU4wKd/OMaWGyjNDU1EgXk3sdbjAF36PtU3hvLmSg='
WHERE
key_id = 'fed89e2472e52d29d7e92e5da6bd17986b8beebc1f83874b09663a0858eb1470'
AND (
token = 'y4DU4wKd/OMaWGyjNDU1EgXk3sdbjAF36PtU3hvLmSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)