UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K5cW7NSKrJpadcuCKd8utxEL8k1LT+N+5zPo9F4//2M='
WHERE
key_id = 'd9350578b483886fa03a4c184137c718ea679c66d4926a840fa44f6446f4ba17'
AND (
token = 'K5cW7NSKrJpadcuCKd8utxEL8k1LT+N+5zPo9F4//2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)