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