UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1nylRrlnWNzPxWpq6Ui6sMweY7eyYbF61kVEO6Fv4s=' 
WHERE 
  key_id = '89a83f703665b505b953c32feec16e241616d1936fdb762acaebf34f6647384e' 
  AND (
    token = 'p1nylRrlnWNzPxWpq6Ui6sMweY7eyYbF61kVEO6Fv4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029