UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't4n/OGa4eTDeSCnBjfXsTGCzLdqKbmQfu0IGtS7WiMc='
WHERE
key_id = 'ad530b9ff7bef19f6ec51d3e9165006c27434c9643d666dbde38ba44c7b8f54a'
AND (
token = 't4n/OGa4eTDeSCnBjfXsTGCzLdqKbmQfu0IGtS7WiMc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)