UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBjGDck5S4n13fVAdJVTE6zAC8duQ4iasFpLJkYX4Yc='
WHERE
key_id = 'd496bddeaca2600a20b44ea6d1cb9f7e43839efcb4d95f2a0cdcf4b560f2f9ea'
AND (
token = 'xBjGDck5S4n13fVAdJVTE6zAC8duQ4iasFpLJkYX4Yc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)