UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQCIP9Xg1ikP0WuOAZa+ufp8IjX8FU4C8JiyKmCGUYw=' 
WHERE 
  key_id = 'bd4bc0626d0238745c2ebe94d807e0795d406a84395152b1dc38332c01680b20' 
  AND (
    token = 'TQCIP9Xg1ikP0WuOAZa+ufp8IjX8FU4C8JiyKmCGUYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040