UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twYh0Sy9dino4aZuPtLkKzs+cawm85+8Qq8juhQfmH4=' 
WHERE 
  key_id = '01c1e0650a087c9e1596e2164645c567698ec2bdc2a2a642f01a1080109e80a1' 
  AND (
    token = 'twYh0Sy9dino4aZuPtLkKzs+cawm85+8Qq8juhQfmH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031