UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p4R1woI/EhtY6X4N+Wq63Xpl3aJJisKwYOBjFXGqJIw='
WHERE
key_id = 'ac25059f4e54f86a076bc830a081e6611cf3450a72c50870433ed28342a6be5e'
AND (
token = 'p4R1woI/EhtY6X4N+Wq63Xpl3aJJisKwYOBjFXGqJIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)