UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sTSbK1KGEd15HETWEwWlN2+5ZqxV69AzIIcZA1MfdLI=' 
WHERE 
  key_id = '26a1f80f2a29211c405fa5668d274f2ee3569f645254c9bf07481093a9920f98' 
  AND (
    token = 'sTSbK1KGEd15HETWEwWlN2+5ZqxV69AzIIcZA1MfdLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025