UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F7zjqhNlcDtz9j++vpjB2joMJlNj0W3Br0wSJha52Qo=' 
WHERE 
  key_id = '0ef8c6ef61157b448bd6717f3fdf676427403c8f6d55285654c74c96ddbdb68b' 
  AND (
    token = 'F7zjqhNlcDtz9j++vpjB2joMJlNj0W3Br0wSJha52Qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023