UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LZr6szheiBxy1zAbobqmM4185Mgu7/snFMKcSm0+3XA=' 
WHERE 
  key_id = '2f2fe0a7d0fdf30be629f5a89b95b41b2469e0c1f11b48303f2628435d2a7e06' 
  AND (
    token = 'LZr6szheiBxy1zAbobqmM4185Mgu7/snFMKcSm0+3XA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021