UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uq3edDZChMokWjfus3rfZc17w9AY2NDeh+4QL1aJsYQ='
WHERE
key_id = 'a43c76af5b0775e05911781e0b3546cf93985bbd861395159bebd27320089180'
AND (
token = 'uq3edDZChMokWjfus3rfZc17w9AY2NDeh+4QL1aJsYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)