UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hdKvdib/zoY4X649gUYZ1fNcdEALhbkjzaTFtWGrsy0='
WHERE
key_id = 'f8ad6bb2a904736c67b3590457e19db93ef7f85d2a97ec6970954f9c0c83fd20'
AND (
token = 'hdKvdib/zoY4X649gUYZ1fNcdEALhbkjzaTFtWGrsy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)