UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8efZRRecnCBvizKYBp3ueYZS7u9UqSWkNdm6ungS4PA=' 
WHERE 
  key_id = '2209285e19cde2295d849c0e8a38d7dec9f6ee19956683cd15230df4050c7b54' 
  AND (
    token = '8efZRRecnCBvizKYBp3ueYZS7u9UqSWkNdm6ungS4PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022