UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ULzLOlcEs67UidUuavu4ndjlHHZWopnqby5P8xXRCEM='
WHERE
key_id = '594f5a52ac557ddc91de7a1e325c27f0cf9f161e70bd307f7e5cad2f2bb6dd25'
AND (
token = 'ULzLOlcEs67UidUuavu4ndjlHHZWopnqby5P8xXRCEM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)