UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yD7myyazvhkgAgyuBFPf0KRgXhxNKohDXx0gScLPUH8=' 
WHERE 
  key_id = 'ba891d4513ae2f85566891dddeb95f0963031f7f0e25dd792664cda51a7d83b9' 
  AND (
    token = 'yD7myyazvhkgAgyuBFPf0KRgXhxNKohDXx0gScLPUH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035