UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IiT/qb7ysBGOWWPgau8WO93lKcmK1CvCLL/RdI92V1c='
WHERE
key_id = 'e81c4feb335fdb0c4cb4478e76ad1e9da4d94fb820ce0323bda3c48462140809'
AND (
token = 'IiT/qb7ysBGOWWPgau8WO93lKcmK1CvCLL/RdI92V1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)