UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0LDhwQi4aizKE3lL/Nbi1yji3j/aFy4+W6+FHTLITEA='
WHERE
key_id = '8db4ad877c8bbaf65fcac1c12b3a9fdc6b522f054bbf5b86c659d6d33276b0bc'
AND (
token = '0LDhwQi4aizKE3lL/Nbi1yji3j/aFy4+W6+FHTLITEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)