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