UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GQj29q9nEj+owYQTYN61y9hWH2ApiX2/dC/LwwyPY6o=' 
WHERE 
  key_id = '17cbf4716dd564e76f78d527c453cc38f09789d3ea3ab0d5f6076007364530a2' 
  AND (
    token = 'GQj29q9nEj+owYQTYN61y9hWH2ApiX2/dC/LwwyPY6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035