UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k6uWnsIKyjSuVPxWqnWp/fcqPnOVuEpctcBEdErV8jk='
WHERE
key_id = 'b3bb12669fc3c1f127b34429ca9792e7e625d328af32356b1e6bf0ef003e5cb5'
AND (
token = 'k6uWnsIKyjSuVPxWqnWp/fcqPnOVuEpctcBEdErV8jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)