UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5iECcwfDiSw2GpvCViCtZRH3YPppvP9zLqSVfFUfYrk='
WHERE
key_id = 'bcba52633ed89925d1b3defe9161431bca22a7b8eb40078caf74ec731da36286'
AND (
token = '5iECcwfDiSw2GpvCViCtZRH3YPppvP9zLqSVfFUfYrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)