UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKKIaAOCFlmdXmfnXuEi6oMk1Kc4xuV2juDG5xPhw44='
WHERE
key_id = '5a7bbecbc7498ce863fc89fcbcc2d42559f2c4b8cb2a4912821d9ef66c3dcb8b'
AND (
token = 'BKKIaAOCFlmdXmfnXuEi6oMk1Kc4xuV2juDG5xPhw44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)