UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z7H/KGCv/1SLf4OvN6AVCFRgE+6y2nvn131rZx2A5PM=' 
WHERE 
  key_id = '6ad82d85e79a123fb359ebcd41e7b9e9beb015d62775c6cfeb486fe63203a16b' 
  AND (
    token = 'Z7H/KGCv/1SLf4OvN6AVCFRgE+6y2nvn131rZx2A5PM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044