UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YsuiT08fjfQ75KREKDfZhSnDbnawXSjPzzfjhDSFi+c='
WHERE
key_id = '7154be9fe7d76051f031414e86ec13aba8fcf26e874641e755aa5fdd8061c0d3'
AND (
token = 'YsuiT08fjfQ75KREKDfZhSnDbnawXSjPzzfjhDSFi+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)