UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cDWI2rZshUHH6L9RVWrwQH9ZB/xsAb2uL0SjboIgzE0=' 
WHERE 
  key_id = '0f79aaf1f03a36612345a7d5dd23432568ed112d8ea4be1516f2011651f1d870' 
  AND (
    token = 'cDWI2rZshUHH6L9RVWrwQH9ZB/xsAb2uL0SjboIgzE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040