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

Query time 0.00035