UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cKr3cbFy1XUofE8z4d8QyVsKJMfK6e9jXsVlfQB79ks=' 
WHERE 
  key_id = '832f37b5913cd33afaa8804d75200d9097aa7f1560266c420d03a7d61ba5d476' 
  AND (
    token = 'cKr3cbFy1XUofE8z4d8QyVsKJMfK6e9jXsVlfQB79ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037