UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HsRlqQGUBrZ6h+A1q1RVUcTNHMvYj3sTNXHIbnXAWQg=' 
WHERE 
  key_id = '992b36972772a53a0bfbf2cd6d0cd5e2b4dac31986fee130ea7d8072ab901d87' 
  AND (
    token = 'HsRlqQGUBrZ6h+A1q1RVUcTNHMvYj3sTNXHIbnXAWQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038