UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wHW5vgSre3SJCtsBfw02rp8AqWTfhn4FugzIPO61NTU='
WHERE
key_id = 'e039b1a6b937dc67710329babda3d605a5d9c135f5c261402041806d6698e944'
AND (
token = 'wHW5vgSre3SJCtsBfw02rp8AqWTfhn4FugzIPO61NTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)